﻿using System;
using System.Xml.Linq;

namespace MyLib {
	/// <summary>
	/// 解析Xml时产生的错误
	/// </summary>
	public class ParseXmlException : Exception {
		/// <summary>
		/// 
		/// </summary>
		/// <param name="message"></param>
		public ParseXmlException(string message)
			: this(message, null) {
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="message"></param>
		/// <param name="xo"></param>
		public ParseXmlException(string message, XObject xo)
			: base(xo == null ? message : message + " at " + xo.FormateLineInfo() + ".") {
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="message"></param>
		/// <param name="xo"></param>
		/// <param name="innerException"></param>
		public ParseXmlException(string message, XObject xo, Exception innerException)
			: base(xo == null ? message : message + " at " + xo.FormateLineInfo() + ".", innerException) {
		}
	} // end of ParseXmlException.
}
